package com.great.dao;

import com.great.domain.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserDao {

    @Delete("delete from user where id=#{id}")//
    public void deluser(String id);

    @Select("select * from user where user_Name like '%${value}%' ")
    public List<User> searchuser(String keyword);

    @Insert("insert into user (user_Name,user_Password,user_Nickname,user_Sex,user_Birthday,user_Email,user_Mobile,user_Address) Values(#{user_Name}," +
            "#{user_Password},#{user_Nickname},#{user_Sex},#{user_Birthday},#{user_Email},#{user_Mobile},#{user_Address})")
    public void adduser(User user);

    @Update("update user set user_Status=1 where id=#{id}")//屏蔽用户
    public void openuser(String id);

    @Update("update user set user_Status=0 where id=#{id}")//修改用户的状态
    public void closeuser(String id);

    @Select("select * from user where id=#{id}")//查找某个用户
    public User findById(String id);

    @Update("Update user set user_Name=#{user_Name},user_Password=#{user_Password},user_Nickname=#{user_Nickname}," +
            "user_Sex=#{user_Sex},user_Birthday=#{user_Birthday},user_Email=#{user_Email},user_Mobile=#{user_Mobile},user_Address=#{user_Address} where id=#{id}")
    public void updateById(User user);//修改用户

    @Select("select count(*) from user where user_Name=#{user_name}")//查找用户数量
    public int usernamecheck(String user_name);

    @Select("select * from user where user_Name=#{user_name} and user_Password=#{user_password}")
    public User selectbyname(@Param("user_name") String user_name, @Param("user_password") String user_password);//登录
}
